UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X2GFUEhUROaUDP0+lM5BoKXg5dida/HHj4jeYObuduk=' 
WHERE 
  key_id = 'f618305712c15a07256ac0e50a2ea7a0979d3d0b4e29ae65f80cf2ed4d63eb5e' 
  AND (
    token = 'X2GFUEhUROaUDP0+lM5BoKXg5dida/HHj4jeYObuduk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030