UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KCcBvAmOEvPQhqBEQEu5F3Vc8rb+pKMARAW0OLU32Bw=' 
WHERE 
  key_id = '9720d634cfd4886f64ccf40c0ce08fb74d5096cf916ef9e3139a9cb059707bb0' 
  AND (
    token = 'KCcBvAmOEvPQhqBEQEu5F3Vc8rb+pKMARAW0OLU32Bw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025