UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BZMd7cjc7Q0+eZIANxQGGVgZ8sVvnzWaEiNQlLYwsDU=' 
WHERE 
  key_id = '53c551962455363a21d1c999de2b6245117b1e9e43bef41651a559e70228246d' 
  AND (
    token = 'BZMd7cjc7Q0+eZIANxQGGVgZ8sVvnzWaEiNQlLYwsDU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033