UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CAuBhyrsnSM2HjyKffnUdawyAVk8GHbZTICFf19QNMs=' 
WHERE 
  key_id = '191f1812c318dfc52757681bdcf40e5483b29f22aa2eee41d6fcf6cee21e1082' 
  AND (
    token = 'CAuBhyrsnSM2HjyKffnUdawyAVk8GHbZTICFf19QNMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025