UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k8tYcaYdR+estc0eU7xguScEbStvK+gqCnldPanlybs=' 
WHERE 
  key_id = '56035240753ff8dcb5145c2a56a44e7479a15232d0f08cf2f3fa3aebd917e3d2' 
  AND (
    token = 'k8tYcaYdR+estc0eU7xguScEbStvK+gqCnldPanlybs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039