UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '78116LuErqgR7G44uM2MRsXU37fzzKoWhUn+l90uOTI=' 
WHERE 
  key_id = 'e16765355ae82290044a400745d7a9751671800e4216157958ae554de438dae9' 
  AND (
    token = '78116LuErqgR7G44uM2MRsXU37fzzKoWhUn+l90uOTI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030