UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NXYMrxUwqPmoIZcmgyzUQuRuV0Bl56RlIkkRC25Xasg=' 
WHERE 
  key_id = 'b51d005b47b0e6a0f93bb1fa094d8bc0220c2439d72eb8dca151359abbd6002e' 
  AND (
    token = 'NXYMrxUwqPmoIZcmgyzUQuRuV0Bl56RlIkkRC25Xasg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023