UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pROyqQ50F6Pc9uI7oqxVxwXDZSKxvPfSr+SMtzlbZpU=' 
WHERE 
  key_id = 'a15a8d211d828ae9b7f0055a38e27232ad8b946f34151e1c3a6c7c85ed9da490' 
  AND (
    token = 'pROyqQ50F6Pc9uI7oqxVxwXDZSKxvPfSr+SMtzlbZpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042