UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'liEJxsFLo8jPBKb8/NXxPTrBp0XlcDgLZ2kV0+/le9I=' 
WHERE 
  key_id = '20e4c502b75b58e092d6691ead3ca3da11e53a347b1450f51c1fe40cc04f186a' 
  AND (
    token = 'liEJxsFLo8jPBKb8/NXxPTrBp0XlcDgLZ2kV0+/le9I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025