UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fqgFwqs7P+7QE5MZqRMktQW3LlTbCxIc3iO+7Vttbhs=' 
WHERE 
  key_id = '1d83537da392a6141a128ae9f8b9901aad4f87684ee2d442c858a35dbeb9c574' 
  AND (
    token = 'fqgFwqs7P+7QE5MZqRMktQW3LlTbCxIc3iO+7Vttbhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031