UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O3OvwswzL0Aqy15FO3iMt5wbXjlhbsO6b3WUVG2InDA=' 
WHERE 
  key_id = 'db917f88ec5d8fa355fad3651c03406ed3e35f918ed3adb91621e54852c28047' 
  AND (
    token = 'O3OvwswzL0Aqy15FO3iMt5wbXjlhbsO6b3WUVG2InDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033