UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+SCEF5hVCgXX6g4bYabY9iDTfG+dkG6b2TuUI+Xd4QY=' 
WHERE 
  key_id = '21025cf71be2621f66aca53d1d458db0de6cf95c9ffad74c96740cbaec35157e' 
  AND (
    token = '+SCEF5hVCgXX6g4bYabY9iDTfG+dkG6b2TuUI+Xd4QY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025