UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZRx50VkRpwPO9u+/ku6zLUPT9AbHhDfAf8efg5TeNis=' 
WHERE 
  key_id = 'b662fc5da6641c55bae416ee3edc5b4bab2267b7f359c89eaf99359efdab0e6d' 
  AND (
    token = 'ZRx50VkRpwPO9u+/ku6zLUPT9AbHhDfAf8efg5TeNis=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016