UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L3BCD7/hn1W8N7XdOdh0Xe+P84pWhz0pm1T1qQPB2fg=' 
WHERE 
  key_id = '6bf5462a351fc3f3e44f2811e738899573c9f7a43df101d12dff30e1879bbf99' 
  AND (
    token = 'L3BCD7/hn1W8N7XdOdh0Xe+P84pWhz0pm1T1qQPB2fg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00241