UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TvmCGMppDYLY44deoL7mI9G2Kt0PF/5VWsN/X0pCW/M=' 
WHERE 
  key_id = '9be3deec18151b291bedd612d0402abefb808186cd39a85ac8c308d59b9fd231' 
  AND (
    token = 'TvmCGMppDYLY44deoL7mI9G2Kt0PF/5VWsN/X0pCW/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033