UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UsGxlVi7GlutohfIRzX2yjq+6vQ0NvqChYtop9TMSEs=' 
WHERE 
  key_id = '48b0e6f19bddbdc7f9537524e33526008c50536a9b1aec945e5ecfb3ac34d297' 
  AND (
    token = 'UsGxlVi7GlutohfIRzX2yjq+6vQ0NvqChYtop9TMSEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042