UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UmStBNGtU4d3hZ6lPJ9ZXiFQRal37sMQyHRr9Hy29jQ=' 
WHERE 
  key_id = '5c864a3e155b143b6e84ca88db4a3954beb3264a9abc6b545b3d676cb98729fc' 
  AND (
    token = 'UmStBNGtU4d3hZ6lPJ9ZXiFQRal37sMQyHRr9Hy29jQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029