UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SM8d0G2ODE1ZSQ5yZzR0KM3fjI394rI5z0luD4F2t/o=' 
WHERE 
  key_id = '7471ba18ddbe6c53a1d87049e23db4c3c48913ae024127746b9e5d1f6e25bc20' 
  AND (
    token = 'SM8d0G2ODE1ZSQ5yZzR0KM3fjI394rI5z0luD4F2t/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043