UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tT2J8XCXtLREtwFRObDZ/4+XJwcrRtXFlYewbEoXjjk=' 
WHERE 
  key_id = 'e2e08f3dd65eb5f1b068e5a9b69ee5d619e1ab3a9bcd6838746e06adc2d75959' 
  AND (
    token = 'tT2J8XCXtLREtwFRObDZ/4+XJwcrRtXFlYewbEoXjjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038