UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AZb5AKOqu0MqQ8OiD4Z3bYJtB9tgNNiuw4MNe7fv/2k=' 
WHERE 
  key_id = '0ce96a3cabcf2054db8de97813dbf1bde5945ca5dfe9d5e4a3de9cd1494293cf' 
  AND (
    token = 'AZb5AKOqu0MqQ8OiD4Z3bYJtB9tgNNiuw4MNe7fv/2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016