UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z78vM5D5kKUeThNZc4TFp1ATvr+GzzKdsiDta99CJdI=' 
WHERE 
  key_id = '0d56ecf9d210a065681c65718d16ff2a0c5cd37bcdae2c44c4883abbbdfb7fb5' 
  AND (
    token = 'z78vM5D5kKUeThNZc4TFp1ATvr+GzzKdsiDta99CJdI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015