UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xX2tLdvvf4lfRRtlNKTHSH68QONxp9XXabcYccWL2RA=' 
WHERE 
  key_id = '66f784696e5799d023b5d8b596b8176e032df73b913226e858e9acb14e55cd58' 
  AND (
    token = 'xX2tLdvvf4lfRRtlNKTHSH68QONxp9XXabcYccWL2RA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019