UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ugoLqlzyVRfmIrzE66lnaTrUR4ugYBbv0KpUsFylxdE=' 
WHERE 
  key_id = '46fa3927af9c3dba71a061280f122b19f1e1fffb5a8b2fe98169747f846fe396' 
  AND (
    token = 'ugoLqlzyVRfmIrzE66lnaTrUR4ugYBbv0KpUsFylxdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037