UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rndB4nShLA7/4XaVktRgdENWbXkS+8ecD7njzD2M+hA=' 
WHERE 
  key_id = '76d629d0e2d3d6773a961b7750281439f3e29798d05b845a59c2c02d8e6b2473' 
  AND (
    token = 'rndB4nShLA7/4XaVktRgdENWbXkS+8ecD7njzD2M+hA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030