UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wjLLklyeADetEjt1TQNAAPPPIzHy2wRexA2S/Yj9wMo=' 
WHERE 
  key_id = '1029fd5eb36de4e192051efbda320ad0c0e55c98628f0aced670e8a63c749b39' 
  AND (
    token = 'wjLLklyeADetEjt1TQNAAPPPIzHy2wRexA2S/Yj9wMo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038