UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lEwYofLPNCQUMXuN2OhUFv7Sdc7F2IzkTJkPKveB2sc=' 
WHERE 
  key_id = '39d223d1c9ba070a4976f5f2b55097e3099a990a5fabf2b63a74926e13d70c8a' 
  AND (
    token = 'lEwYofLPNCQUMXuN2OhUFv7Sdc7F2IzkTJkPKveB2sc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036