UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NkzB6nEiCsuIAursH6Nj9jQzgP6X1Vhutp50s9YbrV4=' 
WHERE 
  key_id = '8306c97ca750550c2868f88eafd294153753e887902fc6df5367eed09f82a0c7' 
  AND (
    token = 'NkzB6nEiCsuIAursH6Nj9jQzgP6X1Vhutp50s9YbrV4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035