UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qi6sx9TBWs8GZjWZ/EgPYhF97EQ31saTNVDOaD/im4E=' 
WHERE 
  key_id = '8ceb507d27b53336849b055742e87f816641a76bad362fe44b27ae74d2ab10ce' 
  AND (
    token = 'Qi6sx9TBWs8GZjWZ/EgPYhF97EQ31saTNVDOaD/im4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025