UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uwFkay1opkNnrCSEB+ohMjujRAPw1MNOplprkvpYqHk=' 
WHERE 
  key_id = '621a0db675aec49b84207ea14b19b4f7b505cabedc021e03c63ed4a9c56ae9a5' 
  AND (
    token = 'uwFkay1opkNnrCSEB+ohMjujRAPw1MNOplprkvpYqHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025