UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vJXd5oahUDqkXD7+WVuPcO0wEpzyUH/LYsjBtr2qJ64=' 
WHERE 
  key_id = '7e261f85192db5afd4c53f6d21af355c3df71995bc8c4da7b3e5943ce87559a5' 
  AND (
    token = 'vJXd5oahUDqkXD7+WVuPcO0wEpzyUH/LYsjBtr2qJ64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039