UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tgd3/I6SUUw3mK2FhbNzrAe32t3x16lyOxrP9DEONzo=' 
WHERE 
  key_id = '7f6f6020f7631d1293cc7b62ce03e363b9e0ebc7d91a508030de107e66bf10b1' 
  AND (
    token = 'Tgd3/I6SUUw3mK2FhbNzrAe32t3x16lyOxrP9DEONzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040