UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y7uY0mmhlDCq7nVO9ox9KPoj29+n1wxBtV3ZRPTov+0=' 
WHERE 
  key_id = '709ba93a7960aac06df33a8037ff48560f473ff705a9a47bb87f9fdffeb14d0a' 
  AND (
    token = 'y7uY0mmhlDCq7nVO9ox9KPoj29+n1wxBtV3ZRPTov+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039