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

Query time 0.00027