UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hVT9v7IBSW8QPXk4rt7YTPPyqj0xUc0QEpTDOVXdySc=' 
WHERE 
  key_id = '4430d2e7199de565296992441b47300a06954ad170beeed51c67076ec2965c27' 
  AND (
    token = 'hVT9v7IBSW8QPXk4rt7YTPPyqj0xUc0QEpTDOVXdySc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037