UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qX8pCh5SCznZMN5+pg0r4DSAmVYE07bqtXxgzkfwTj0=' 
WHERE 
  key_id = '46fce55e94ed4d33a4fd4836faedfa87d0a6e435791e5a76312767be68ca6c11' 
  AND (
    token = 'qX8pCh5SCznZMN5+pg0r4DSAmVYE07bqtXxgzkfwTj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037